#include "View.h"

using namespace std; 

string View::default = "lal";

bool View::handleNFA(TiXmlElement *element, float &near, float &far, float &angle) {

	if (element->QueryFloatAttribute("near", &near) == TIXML_SUCCESS &&
		element->QueryFloatAttribute("far", &far) == TIXML_SUCCESS &&
		element->QueryFloatAttribute("angle", &angle) == TIXML_SUCCESS) {
			return NO_ERROR;
	}

	return ERROR;
}
		
bool View::handleVector(TiXmlElement *element, float &x, float &y, float &z) {

	if (element->QueryFloatAttribute("x", &x) == TIXML_SUCCESS &&
		element->QueryFloatAttribute("y", &y) == TIXML_SUCCESS &&
		element->QueryFloatAttribute("z", &z) == TIXML_SUCCESS) {
			return NO_ERROR;
	}

	return ERROR;
}

bool View::handleNFF(TiXmlElement *element, float &near, float &far, float &left, 
											float &right, float &top, float &bottom) {
	if (element->QueryFloatAttribute("near", &near)		== TIXML_SUCCESS &&
		element->QueryFloatAttribute("far", &far)		== TIXML_SUCCESS &&
		element->QueryFloatAttribute("left", &left)     == TIXML_SUCCESS &&
		element->QueryFloatAttribute("right", &right)   == TIXML_SUCCESS &&
		element->QueryFloatAttribute("top", &top)       == TIXML_SUCCESS &&
		element->QueryFloatAttribute("bottom", &bottom) == TIXML_SUCCESS) {
			return NO_ERROR;
	}

	return ERROR;
}

